class A:
    __num = 0

    def __init__(self):
        print("父类的__init__方法被执行")
        A.add()
        self.parent = 'I\'m the parent.'
        #print('Parent')

    @classmethod
    def add(self):
        self.__num +=1
        print("累计相加%s" % self.__num)

    @classmethod
    def getNun(self):
        return self.__num

    def __new__(self):
        print("父类的__new__方法被执行")
        A.add()
        #return super().__new__(self)
        #return A;

    @classmethod
    def say(self):
        print('父类调用了say')


class B(A):
    #def __new__(self):
        #print("__new__方法被执行")
        #return super().__new__(self)

    #def __init__(self):
        # super(FooChild,self) 首先找到 FooChild 的父类（就是类 FooParent），然后把类 FooChild 的对象转换为类 FooParent 的对象
        #print("__init__方法被执行")
        #super(B, self).__init__()
        #print('Child')
       #self.name = ''

    #def __init__(self):
       # super(B, self).__init__()
        #self.bb = 1
    @classmethod
    def say(self):
        print('子类调用了say')
    def add(self):
        super(B,self).add()

if __name__ == '__main__':
    #b = B()
    #a = B()
    c = B()
    print(c.say())

    print("总共被实例化了%s" % A.getNun())
    #b.add()  # 3